import javax.swing.*;
import java.awt.*;

public class eg9_3 {
    public static void main(String[] args) {
        BoderLayoutFrame frame2=new BoderLayoutFrame();
    }

    public static class BoderLayoutFrame extends JFrame {
        private JButton button1;
        private JButton button2;
        private JButton button3;
        private JButton button4;
        private JButton button5;

        public BoderLayoutFrame(){
            button1 =new JButton("按钮1");
            button2 =new JButton("按钮2");
            button3 =new JButton("按钮3");
            button4 =new JButton("按钮4");
            button5 =new JButton("按钮5");
            this.setLayout(new BorderLayout(20,20));
            this.add(button1,BorderLayout.NORTH);
            this.add(button2,BorderLayout.SOUTH);
            this.add(button3,BorderLayout.WEST);
            this.add(button4,BorderLayout.EAST);
            this.add(button4,BorderLayout.CENTER);
            this.setTitle("BoderLayout边框布局");
            this.setSize(600,400);
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            this.setVisible(true);
        }
    }
}
